/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.wooxes.server;

import java.io.File;

/**
 *
 * @author woox
 */
public class DeleteFile {

    static public boolean deleteDirectory(String path){
        File file = new File(path);
        return deleteDirectory(file);
    }
    
    static public boolean deleteDirectory(File path) {
        if( path.exists() ) {
        File[] files = path.listFiles();
            for(int i=0; i<files.length; i++) {
                if(files[i].isDirectory()) {
                deleteDirectory(files[i]);
                }
                else {
                    files[i].delete();
                }
            }
        }
        return( path.delete() );
    }
}